<?php
$html = str_replace('<!--{pageHeader}-->', $pageHeader, $html);
$html = str_replace('<!--{photographyTitulo}-->', htmlentities($photography->titulo), $html);
$html = str_replace('<!--{url}-->', URL, $html);
$html = str_replace('<!--{photographyToSelect}-->', Photography::toSelect($gallery), $html);

$html = str_replace('<!--{galleryId}-->', $gallery->id, $html);
$html = str_replace('<!--{galleryTitulo}-->', $gallery->titulo, $html);
$html = str_replace('<!--{galleryDescripcion}-->', $gallery->descripcion, $html);
$html = str_replace('<!--{photographyId}-->', $photography->id, $html);

//imagenes
$images = '';
$alea = rand(1, 9999);
foreach ($gallery->imagenes() as $img) {
    $images .= $imagesTpl;
    $images = str_replace('<!--{imagenId}-->', $img->id, $images);
    $images = str_replace('<!--{imagenSrc}-->', $img->src, $images);
    $images = str_replace('<!--{alea}-->', $alea, $images);
}
$images = str_replace('<!--{urlThumb}-->', URL.'content/photography/'.$photography->uri.'/thumbnail/', $images);
$images = str_replace('<!--{urlCrop}-->', URL.'content/photography/'.$photography->uri.'/', $images);
$html = str_replace('<!--{imagenes}-->', $images, $html);

$html = preg_replace('/<!-+\{*[A-Za-z0-9]*\}*-+>/', '', $html);
?>
